import { getAreaObj } from '@/utils/util'
const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{
			label: '工单编号',
			prop: 'number',
		},
		{
			label: '服务组织名称',
			prop: 'receiverServiceOrg',
		},
		{
			label: '服务对象',
			prop: 'elderName',
		},
		{
			label: '身份证号',
			prop: 'idCardNo',
		},
		{
			label: '联系方式',
			prop: 'mobile',
		},
		{
			label: '服务员',
			prop: 'receiverName',
		},
		{
			label: '服务项目',
			prop: 'serviceName',
		},
		{
			label: '消费金额',
			prop: 'money',
		},
		{
			label: '服务开始时间',
			prop: 'startStr',
		},
		{
			label: '服务结束时间',
			prop: 'endStr',
		},
		{
			label: '操作',
			prop: 'menu',
			width: 100,
			fixed: 'right',
		},
	],
}

const detailConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '工单编号',
			prop: 'number',
			span: 12,
		},
		{
			label: '老人身份证号',
			prop: 'idCardNo',
			span: 12,
		},
		{
			label: '服务对象',
			prop: 'elderName',
			span: 12,
		},
		{
			label: '联系方式',
			prop: 'mobile',
			span: 12,
		},
		{
			label: '老人类型',
			prop: 'elderType',
			type: 'remoteSelect',
			code: 'ELDER_TYPE_WORKORDER',
			api: 'getDictItemList',
			filterKey: 'value',
			span: 12,
		},
		{
			label: '失能状况',
			prop: 'disabilityCondition',
			span: 12,
		},
		{
			label: '服务组织名称',
			prop: 'receiverServiceOrg',
		},
		{
			label: '服务员',
			prop: 'receiverName',
			span: 12,
		},
		{
			label: '服务类型',
			prop: 'serviceType',
			span: 12,
		},
		{
			label: '服务内容',
			prop: 'serviceName',
			span: 12,
		},
		{
			label: '服务项目价格',
			prop: 'money',
			span: 12,
		},
		{
			label: '备注',
			prop: 'content',
			span: 12,
		},
		{
			label: '工单来源',
			prop: 'source',
			span: 12,
		},
		{
			label: '工单需求服务时间',
			prop: 'serviceStr',
			span: 12,
		},
		{
			label: '服务开始时间',
			prop: 'startStr',
			span: 12,
		},
		{
			label: '服务结束时间',
			prop: 'endStr',
			span: 12,
		},
	],
}

const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '工单编号',
			prop: 'number',
			span: 8,
		},
		{
			label: '服务组织名称',
			prop: 'receiverServiceOrg',
			span: 8,
		},
		{
			label: '服务对象',
			prop: 'receiverName',
			span: 8,
		},
		{
			label: '身份证号',
			prop: 'idCardNo',
			span: 8,
		},
		{
			label: '联系方式',
			prop: 'mobile',
			span: 8,
		},
		{
			label: '服务员',
			prop: 'receiverName',
			span: 8,
		},
		{
			label: '服务项目',
			prop: 'serviceName',
			span: 8,
		},
		{
			label: '服务开始时间',
			prop: 'startStr',
			type: 'datetime',
			format: 'YYYY年MM月DD HH:mm:ss',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			span: 8,
		},
		{
			label: '服务结束时间',
			prop: 'endStr',
			type: 'datetime',
			format: 'YYYY年MM月DD HH:mm:ss',
			valueFormat: 'YYYY-MM-DD HH:mm:ss',
			span: 8,
		},
	],
}

export const baseConfig: any = {
	pageName: '人脸助餐记录',
	addLabel: '',
	dictcodes: ['ELDER_TYPE_WORKORDER'],
	rowKey: 'id',
	// tipLabel: 'projectName',
	api: {
		index: 'view_orderRecords_page',
		detail: 'view_orderRecords_id',
	},
	auth: {
		index: 'view_orderRecords_page',
		detail: 'view_orderRecords_id',
	},

	menuBtn: [
		{
			icon: 'detail',
			label: '查看',
			type: 'primary',
			operate: 'detail',
			auth: 'view_orderRecords_id',
			text: true,
			show: true,
		},
	],
	dialogConfig: {
		width: '65%',
	},
	beforeOnLoadFormate: async (query) => {
		return new Promise((resolve, reject) => {
			const crAreasObj: any = getAreaObj(query.authAreas, '')
			resolve({
				...query,
				...crAreasObj,
				authAreas: undefined,
			})
		})
	},
	searchConfig,
	tableConfig,
	detailConfig,
}
